package org.scohen.juploadr.uploadapi.flickrrest.urls;

import java.net.MalformedURLException;
import java.net.URL;

import org.scohen.juploadr.uploadapi.flickrrest.DefaultFlickrHandler;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;

public class GetUserPhotosHandler extends DefaultFlickrHandler {
    private GetUserPhotos gup;
 
    public GetUserPhotosHandler(Object parent) {
        super(parent);
        gup = (GetUserPhotos) parent;
    }

    public void startElement(String uri, String localName, String qname, Attributes atts) throws SAXException {
        super.startElement(uri, localName, qname, atts);
        if("user".equals(qname)) {
            try {
                gup.setURL(new URL(atts.getValue("url")));
            } catch (MalformedURLException e) {
               // let's hope that flickr doesn't send us malformed URLs.
            }
        }
    }

}
